use "dataset_fort_worth_cross", clear

local i = 1

foreach y in logncrimeincidentspcp logpropertyvalues {
	
	if "`y'" == "logncrimeincidentspcp" local ytitle "Crime"
	if "`y'" == "logpropertyvalues" local ytitle "Property values"

	foreach x in pctnhblack distancemi {

		if "`x'" == "pctnhblack" local xtitle "Share Black"
		if "`x'" == "distancemi" local xtitle "Distance from shooting"
	
		cor `y' `x' [aw=totalvotes]
		local myrho = string(`r(rho)', "%20.02fc")
	
		#delimit;
		
		gr tw
			(sc `y' `x', col(gray) msym(O) msize(small))
			(lpoly `y' `x' [aw=totalvotes], col(black) lwid(thick))
			,
				legend(off)
				plotregion(style(none))
				ylab(, angle(horiz))
				name(g`i', replace)
				xtitle(`xtitle')
				ytitle(`ytitle')
				subtitle("r=`myrho'")
				;
				
		#delimit cr
		
		gr close
		
		local i = `i' + 1
	
	}
	
}

gr combine g1 g2 g3 g4 , rows(2)

gr export "_output/figure A10.pdf", replace
